package br.com.rglariguet.pioneer.util;

import br.com.rglariguet.pioneer.dao.PecaDAO;

public class PecaUtil {
	
	public static boolean pecaExiste(String codigoComDescricao, PecaDAO pecaDao) {
		return pecaDao.buscaPorCodigo(codigoComDescricao.split(" - ")[0]) != null;
	}

	public static boolean validaPecaComTraco(String codigo) {
		return codigo.split(" - ").length == 2;
	}
	
	public static String recuperaCodigoDaPecaComDescricaoConcatenada(String codigoComDescricao){
		return codigoComDescricao.split(" - ")[0];
	}
}
